/**
 * 
 */
package at.ac.tuwien.swa075.telco.bc.dao;

import java.sql.Timestamp;
import java.util.List;

import at.ac.tuwien.swa075.telco.bc.BCException;

/**
 * @author vovmj01
 *
 */
public interface IBookingDAO {
	/**
	 * Deletes an existing booking
	 * @param bookingNumber The identifying booking number.
	 * @return true if an booking was deleted.
	 * @throws BCException An error occured while deleting the booking.
	 */
	public boolean deleteBooking(String bookingNumber) throws BCException;
	
	/**
	 * Deletes all bookings marked as billing for a given period.
	 * @param imei The device number
	 * @param from The start of the period.
	 * @param to The end of the peroid.
	 * @return The number of deleted bookings.
	 * @throws BCException An error occurred during delete.
	 */
	public int deleteBilledBookings(String imei, Timestamp from, Timestamp to) throws BCException;
	
	/**
	 * Returns all bookings for a given device.
	 * @param imei The international mobile equipment id.
	 * @return The list of bookings.
	 * @throws BCException An error occured during search.
	 */
	public List<BookingTO> selectBookingsByEquimentId(String imsi) throws BCException;
	
	/**
	 * Returns all booking with a given status.
	 * @param status The status as a string.
	 * @return The list of bookings.
	 * @throws BCException An error occured during search.
	 */
	public List<BookingTO> selectBookingsByStatus(String status) throws BCException;
	
	/**
	 * Returns all booking with a given status in a given period of time.
	 * @param status The status as a string.
	 * @param from The start of the period.
	 * @param to The end opf the period.
	 * @return The list of bookings.
	 * @throws BCException An error occured during search.
	 */
	public List<BookingTO> selectBookingsByStatus(String status, Timestamp from, Timestamp to) throws BCException;

	
	/**
	 * Creates a new booking with the given booking data.
	 * 
	 * @param booking The booking object.
	 * @return Returns the booking number.
	 * @throws BCException An error occured while creating a new booking
	 */
	public String insertBooking(BookingTO booking) throws BCException;
	
	/**
	 * Updates the data of an existing booking.
	 * @param booking The booking object.
	 * @return Returns true if data was changed.
	 * @throws BCException An error occured while updating the data.
	 */
	public boolean updateBooking(BookingTO booking) throws BCException;
}
